//
//  UIColor+ColorExtension.m
//
//
//  Created by bianruifeng on 14/12/25.
//  Copyright (c) 2014年 bian. All rights reserved.
//

#import <UIKit/UIKit.h>

#define RGB(r, g, b) [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:1.0]
#define RGBAlpha(r, g, b, a) [UIColor colorWithRed:((r) / 255.0) green:((g) / 255.0) blue:((b) / 255.0) alpha:(a)]
#define hexColor(colorV) [UIColor colorWithHexColorString:@#colorV]
#define hexColorAlpha(colorV,a) [UIColor colorWithHexColorString:@#colorV alpha:a];



@interface UIColor (Extend)



/**
 *  (随机)一个UIColor的颜色
 *
 *  @return 返回一个UIColor的颜色
 */
+ (UIColor *)randomColor;





/**
 *  16进制颜色(html颜色值)字符串转为UIColor
 *
 *  @param hexColor 16进制的颜色字符串
 *
 *  @return 返回UIColor颜色 透明度:1.0
 */
+ (UIColor *)colorWithHex:(NSString *)hexColor;
/**
 *  十六进制颜色
 */
+ (UIColor *)colorWithHexColorString:(NSString *)hexColorString;



/**
 *  16进制颜色(html颜色值)字符串转为UIColor
 *
 *  @param hexColor 16进制的颜色字符串
 *  @param opacity  透明度 0.0~1.0
 *
 *  @return 返回UIColor颜色
 */
+ (UIColor *)colorWithHex:(NSString *)hexColor alpha:(float)opacity;
/**
 *  十六进制颜色:含alpha
 */
+ (UIColor *)colorWithHexColorString:(NSString *)hexColorString alpha:(float)alpha;



/**
 *  根据颜色返回十六进制的颜色值
 *
 *  @param originColor 已知颜色
 *
 *  @return 返回16进制颜色
 */
- (NSString *)getHexStringByColor:(UIColor *)originColor;



/**
 *  根据颜色返回rgb的颜色值
 *
 *  @param originColor 已知颜色
 *
 *  @return 返回rgb颜色
 */
- (NSDictionary *)getRGBDictionaryByColor:(UIColor *)originColor;


/**
 *  @author bianruifeng, 16-06-03 01:06:30
 *
 *  @brief 获取image中的指定坐标位置的颜色
 *
 *  @param point 坐标点
 *  @param image
 *
 *  @return 返回颜色
 */
+ (UIColor*) getPixelColorAtLocation:(CGPoint)point inImage:(UIImage *)image;




FOUNDATION_EXPORT UIColor * randomColor();

//FOUNDATION_EXPORT UIColor *colorWithRGBA(int R,int G,int B,int A)
//{
// return [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A];
//}
FOUNDATION_EXPORT UIColor *UIColorWithRGBA(CGFloat Red,CGFloat Green,CGFloat Blue,CGFloat alpha);


@end
